﻿using System.Drawing;

namespace LocationAwareness
{
    public class Functions
    {
        /// <summary>
        /// Method to scale a Bitmap.
        /// </summary>
        /// <param name="graphic">Bitmap to scale.</param>
        /// <param name="width">Width to scale.</param>
        /// <param name="heigth">Height to scale.</param>
        /// <returns>Scaled Bitmap.</returns>
        public static Bitmap ScaleGraphics(Bitmap graphic, int width, int heigth)
        {
            Bitmap scaledGraphic = new Bitmap(width, heigth);

            using (Graphics graphics = Graphics.FromImage(scaledGraphic))
            {
                graphics.DrawImage(graphic, new Rectangle(0,0,width,heigth), 
                    new Rectangle(0,0,graphic.Width,graphic.Height), GraphicsUnit.Pixel);
            }

            return scaledGraphic;
        }
    }
}
